#!/bin/bash

set -e

function visit
{
    local dir="$1"
    for file in `ls $1`
    do
        if [ -f "$dir/$file" ]
        then
            echo "$dir/$file is a regular file!"
        elif [ -d "$dir/$file" ]
        then
            echo "$dir/$file is a directory!"
            visit "$dir/$file"
        else
            echo "$dir/$file is not recognized!"
        fi
    done
}

visit .
